#include<iostream>
#include<string>
using namespace std;
bool mattch(const char* s1, const char* s2)
{
	if (*s1 == '\0' && *s2 == '\0') return true;
	else if (*s1 == '\0' || *s2 == '\0') return false;
	if (*s1 == '?')
	{
		return mattch(s1 + 1, s2 + 1);
	}
	else if (*s1 == '*')
	{
		return mattch(s1 + 1, s2) || mattch(s1 + 1, s2 + 1) || mattch(s1 + 1, s2 + 1);
	}
	else if (*s1 == *s2)
	{
		return mattch(s1 + 1, s2 + 1);
	}
	return false;
}
int main()
{
	string s1, s2;
	while (cin >> s1 >> s2)
	{
		if (mattch(s1.c_str(), s2.c_str()))
		{
			cout << "true";
		}
		else cout << "false";
	}
	return 0;
}